import { request } from "@/utils";

export const ExportExeclFileService = (data: any) => {
  return request.get({
    url: "/export",
    data,
    params: data,
  });
};

export function UploadArticleCoverImageService(file: any, type?: string) {
  return request.post({
    url: "/file/pic",
    data: {
      file,
      type,
    },
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
}
export function GetAllPictureService() {
  return request.get({
    url: "/file/img",
  });
}
export function UploadPics(files: any) {
  return request.post({
    url: "/file/pics",
    data: {
      files,
    },
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
}

// 获取图片的分类
export function GetFileByAttributeService(params: any) {
  return request.get({
    url: "/file",
    params,
  });
}

/**
 * 更新文件的方法
 * @param data 更新文件
 * @returns
 */
export function UpdateFileLocationService(data: any) {
  return request.patch({
    url: "/file",
    data,
  });
}

// 更新文件基本信息
export function UpdateFileInfoService(data: any) {
  return request.patch({
    url: "/file/info",
    data,
  });
}

/**
 * 删除文件
 * @param data 删除数据
 * @returns
 */

// @ts-ignore
export function DeleteFileService(data: any) {
  return request.delete({
    url: "/file",
    data,
  });
}
